#include <stdio.h>
#include <sqlite3-wrapper.h>
#include <glib.h>

int testcase1(){
	printf("testcase1 start\n");
	void* object;
	object = sqlite3_wrapper_create_object("test");
	sqlite3_wrapper_close(object);
}
int testcase2(){
	printf("testcase2 start\n");
	void* object;
	object = sqlite3_wrapper_create_object("test");
	sqlite3_wrapper_execute_set(object, "update test set health=9 where id=2");
	sqlite3_wrapper_close(object);
}
int testcase3(){
	printf("testcase3 start\n");
	void* object;
	GSList* list;
	object = sqlite3_wrapper_create_object("test");
	list=sqlite3_wrapper_execute_get(object, "select name from test where id=1");

	int len = g_slist_length(list);
	printf("len is %d\n", len);
	int i=1;
	for(i=1;i<len;i++){
		GString* det = (GString*) g_slist_nth_data(list, i);
		printf("data : %s \n", det->str);
	}
	
	sqlite3_wrapper_close(object);
}
int testcase4(){
	printf("testcase4 start\n");
	void* object;
	GSList* list;
	object = sqlite3_wrapper_create_object("test");
	list=sqlite3_wrapper_execute_get(object, "select health from test where id=1");

	int len = g_slist_length(list);
	printf("len is %d\n", len);
	int i=1;
	for(i=1;i<len;i++){
		GString* det = (GString*) g_slist_nth_data(list, i);
		printf("data : %s \n", det->str);
	}
	
	sqlite3_wrapper_close(object);
}

int main(){
	testcase1();
	testcase2();
	testcase3();
	testcase4();
}
